home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / comm / msged400.zip / src / rdirent.h < prev    next >
C/C++ Source or Header  |  1996-06-22  |  3KB  |  107 lines

  1. /*
  2.    **  DIRENT.H - Posix compliant header
  3.    **
  4.    **  Original Copyright 1988-1991 by Bob Stout as part of
  5.    **  the MicroFirm Function Library (MFL)
  6.    **
  7.    **  This subset version is functionally identical to the
  8.    **  version originally published by the author in Tech Specialist
  9.    **  magazine and is hereby donated to the public domain.
  10.  */
  11.  
  12. #ifndef DIRENT_H
  13. #define DIRENT_H
  14.  
  15. #include <stdio.h>              /* For FILENAME_MAX     */
  16. #include <dos.h>
  17.  
  18. #ifndef OS2
  19. #if defined(__ZTC__)
  20. #define DSTRUCT       FIND      /* ZTC++/SC++           */
  21. #define ATTRIBUTE     attribute
  22. #define NAME          name
  23. #define TIME          time
  24. #define DATE          date
  25. #define FSIZE         size
  26. #pragma pack(1)
  27. #include <direct.h>
  28. #elif defined(__TURBOC__)
  29. #define DSTRUCT       ffblk     /* TC/C++               */
  30. #define ATTRIBUTE     ff_attrib
  31. #define NAME          ff_name
  32. #define TIME          ff_ftime
  33. #define DATE          ff_fdate
  34. #define FSIZE         ff_fsize
  35. #include <dir.h>
  36. #elif defined(PACIFIC)          /* Pacific C            */
  37. struct DSTRUCT
  38. {
  39.     unsigned char reserved[21];
  40.     unsigned char ATTRIBUTE;
  41.     unsigned short TIME;
  42.     unsigned short DATE;
  43.     unsigned long FSIZE;
  44.     char NAME[13];
  45. };
  46. #else
  47. #define DSTRUCT       find_t    /* Assume MSC/QC        */
  48. #define ATTRIBUTE     attrib
  49. #define NAME          name
  50. #define TIME          time
  51. #define DATE          date
  52. #define FSIZE         size
  53. #pragma pack(1)
  54. #include <direct.h>
  55. #endif
  56. #else                           /* OS/2                 */
  57. #define INCL_DOSFILEMAN
  58. #include <os2.h>
  59. struct DSTRUCT
  60. {
  61.     BYTE reserved[21];
  62.     BYTE ATTRIBUTE;
  63.     FTIME TIME;
  64.     FDATE DATE;
  65.     ULONG FSIZE;
  66.     CHAR NAME[13];
  67. };
  68. #endif
  69.  
  70. #define FA_ANY 0xff
  71. #undef FA_DIREC
  72. #define FA_DIREC 0x10
  73.  
  74. /*
  75.    **  Portable find first/next functions from RFIND1ST.C
  76.  */
  77.  
  78. struct DSTRUCT *rfind_1st(char *, unsigned, struct DSTRUCT *);
  79. struct DSTRUCT *rfind_nxt(struct DSTRUCT *);
  80.  
  81. typedef struct
  82. {
  83.     int dd_fd;
  84.     unsigned dd_loc, dd_size;
  85.     struct DSTRUCT dd_buf;
  86.     char dd_dirname[FILENAME_MAX];
  87. }
  88. DOS_DIR;
  89.  
  90. DOS_DIR *opendir(char *);
  91. int closedir(DOS_DIR *), rewinddir(DOS_DIR *);
  92. struct DSTRUCT *readdir(DOS_DIR *), *seekdir(DOS_DIR *, int, int);
  93. #define         telldir(dd) dd->loc
  94.  
  95. /*
  96.    **  Other useful functions from DIRMASK.C and PATMAT.C
  97.  */
  98.  
  99. int dirmask(struct DSTRUCT *, char *, char *, unsigned, unsigned);
  100. int patmat(const char *, const char *);
  101.  
  102. extern int DFerr;
  103.  
  104. extern DOS_DIR _DIRS[];
  105.  
  106. #endif                          /* DIRENT_H */
  107.